﻿using PS.Algorithms;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using PS.DataTypes;

namespace PS.Test
{
    
    
    /// <summary>
    ///This is a test class for DijkstraTest and is intended
    ///to contain all DijkstraTest Unit Tests
    ///</summary>
    [TestClass()]
    public class DijkstraTest
    {
        /// <summary>
        ///A test for Run
        ///</summary>
        [TestMethod()]
        public void RunTest()
        {
            Vertex v0 = new Vertex(0);
            Vertex v1 = new Vertex(1);
            Vertex v2 = new Vertex(2);
            Vertex v3 = new Vertex(3);
            Vertex v4 = new Vertex(4);

            Vertex[] vertices = new Vertex[5];
            vertices[0] = v0;
            vertices[1] = v1;
            vertices[2] = v2;
            vertices[3] = v3;
            vertices[4] = v4;

            Edge e1 = new Edge(v0, v1, 3);
            Edge e2 = new Edge(v0, v2, 2);
            Edge e3 = new Edge(v2, v3, 2);
            Edge e4 = new Edge(v2, v4, 5);
            Edge e5 = new Edge(v1, v3, 1);
            Edge e6 = new Edge(v4, v3, 3);
            Edge e7 = new Edge(v1, v4, 4);

            Edge[] edges = new Edge[7];
            edges[0] = e1;
            edges[1] = e2;
            edges[2] = e3;
            edges[3] = e4;
            edges[4] = e5;
            edges[5] = e6;
            edges[6] = e7;

            Graph graph = new Graph(vertices, edges);
            Vertex start = v0;
            Vertex goal = v4;
            Dijkstra.Run(graph, start, goal);
            Dijkstra.GetShortestPath(graph, start, goal);
        }
    }
}
